<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // ['1','3','5','3','5','3','8','9'] 统计次数 次数最大的次数是谁
      let arr = ['1', '3', '5', '3', '5', '3', '8', '9']
      let a = []
      let b = {}
      arr.forEach((item) => {
        if (a.indexOf(item) == -1) {
          a.push(item)
          b[item] = 1
        } else {
          b[item]++
        }
      })
      console.log(b)
      let max = 0
      let c = []
      for (const k in b) {
        if (b[k] > max) {
          max = b[k]
          c.push[k]
        }
      }
      console.log(max)
    </script>
  </body>
</html>
